import React, { Component } from 'react'
import Child from './Child'

export default class Parent extends Component {
  state = {
    salary: 11.46,
    obj: {
      age: 18,
    },
  }
  handleClick = () => {
    this.setState({ salary: 13 })
  }
  fn() {
    console.log('传递函数')
  }
  render() {
    const { salary, obj } = this.state
    return (
      <div>
        <h3>父：黑马武汉前端 64 期平均工资 {salary}</h3>
        <button onClick={this.handleClick}>修改 salary</button>
        <hr />
        {/* bBar='true' */}
        {/* 和上面等价 */}
        {/* bBar={'true'} */}
        {/* age="20" */}
        {/* 和上面等价 */}
        {/* age={'20'} */}
        <Child
          name='ifer'
          salary={salary}
          obj={obj}
          bBar={true}
          age={20}
          fn={this.fn}
          jsxEle={<h1>hello</h1>}
        />
      </div>
    )
  }
}
